<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="产量登记" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link href="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.css" rel="stylesheet" type="text/css">
<script src="/js/popup_ext.js"></script>
<script src="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.js"></script>
<script language="javascript">
	function doCancel(){
		parent.ClosePop();
	}
	function doSave(flag){
		if(flag=='2'){//并完工
			document.getElementById("comp").value="IY";
			document.getElementById("continue_flag").value="0";
		}else if(flag=='3'){//并工序完工
			document.getElementById("comp").value="PY";
			document.getElementById("continue_flag").value="0";
		}else{
			document.getElementById("comp").value="N";
			document.getElementById("continue_flag").value=flag;
		}
		frm.submit();
	}
	function doInit(){
		var percent = document.getElementById("percent_0");
		if(percent.value!=null && percent.value!=""){
		   percent.select();
		}else{
		   percent.focus();
		}
		showFormErrorMsg();
	}
	function checkInput(index){
		if(window.event.keyCode==13){
			var ind=index-0+1;
			if(document.getElementById("percent_"+ind)!=null){
				document.getElementById("percent_"+ind).focus();
			}else{
				//doOk();
				frm.submit();
			}
		}
	}
</script>
</head>
<c:set var="dateEdit" value="Y" />
<c:if test="${currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';NO_BILL_DATE;')!=-1}">
	<c:set var="dateEdit" value="N" />
</c:if>
<body onload="doInit();" class="sheet modal-dialog" style=" padding-top:10px;">
<div class="sheet-main" id="bodyDiv" style="width:360px;">
  <div class="sheet-list" style="width:100%">
    <div class="modal-main search-business">
		<div style="width:100%;">
 			<c:set var="pageTopTitle" value="产量登记" />
			<%@ include file="../inc/PageTop.jsp"%>
			
			<form name="frm" method="post" action="OutputMultiNew.ihtm">
			<table border="0" cellspacing="1" cellpadding="1" align="center" class="table-a">
			    <tr>
			    	<th>工序：</th>
			      	<td>
			      		<select name="pro_id" id="pro_id" <c:if test="${fromType=='TASK'}">readOnly="true"</c:if>>
			      			<c:forEach var="item" items="${proList}">
			      			<option value="${item.id}" <c:if test="${item.id==proId}">selected</c:if>>${item.processName}</option>
			      			</c:forEach>
			      		</select>
			      	</td>
			    </tr>
			    <tr>
			    	<th>制作日期：</th>
			      	<td >
			      		<input type="text" maxlength="15" id="make_date" name="make_date" value="${makeDate}" <c:if test="${dateEdit=='Y'}">class="TextBox Datetime"</c:if><c:if test="${dateEdit=='N'}">class="TextBox Datetime readonly" readonly="true"</c:if>>
			      		<c:if test="${dateEdit=='Y'}"><img src="/images/calendar.gif" style="cursor:pointer" onClick="displayCalendar(document.getElementById('make_date'),'yyyy-mm-dd',document.getElementById('make_date'));"></c:if>
			      	</td>
			    </tr>
			    <c:forEach var="item" items="${nameList}" varStatus="i">
				<tr>
			      	<th>${item}：</th>
			      	<td>
			      		<input type="text" class="TextBox" style="width:70px" id="percent_${i.index}" name="percent_${i.index}" value="${perList[i.index]}" onKeyUp="checkInput(${i.index});">
			      		<input type="hidden" id="id_${i.index}" name="id_${i.index}" value="${idList[i.index]}">
			      		<input type="hidden" id="name_${i.index}" name="name_${i.index}" value="${item}">
			     	</td>
				</tr>
				</c:forEach>
			    <tr>
			    	<th colspan="2" style="text-align:left">
			      		<span class="give" style="padding-left:10px;">1表示全部由本人完成，0.5表示本人完成一半，以此类推。</span>
			      		<br>
			      		<span class="give" style="padding-left:10px;">【完成情况】${bbItem.compStr}</span>
			      	</th>
			    </tr>
			</table>		

			<input type="hidden" id="item_id" name="item_id" value="${itemId}">
			<input type="hidden" id="wc_id" name="wc_id" value="${wcId}">
			<input type="hidden" id="from_type" name="from_type" value="${fromType}">
			<input type="hidden" id="maker_num" name="maker_num" value="${fn:length(idList)}">
			<input type="hidden" id="continue_flag" name="continue_flag" value="">
			<input type="hidden" id="comp" name="comp" value="N">
			</form>
		</div>
  	</div>
  </div>
	<div class="modal-buttom">
		<input type="button" class="buttom-a" value=" 保 存 " onClick="doSave('');">
		<c:if test="${fromType!='TASK'}">
			<!--
			<input type="button" class="buttom-a" value="保存并新增" onClick="doSave('1');">
			-->
			<input type="button" class="buttom-a" value="保存并完工" onClick="doSave('2');">
		</c:if>
		<c:if test="${fromType=='TASK'}">
			<input type="button" class="buttom-a" value="保存并完工" onClick="doSave('3');">
		</c:if>
		<input type="button" class="buttom-a" value=" 取 消 " onClick="doCancel();">
	</div>  
</div>

</body>
</html>